
let Nums ={

  state: {
    count: 0
  },
  mutations: {
    increment: state => state.count++,

    decrement: state => state.count--,

    increadd (state,n) {
      state.count += n
    },
    decrementdel (state,n) {
      state.count -= n
    },
    //异步调用
    mutationsAddCount(state, n = 0) {
      console.log("mutations异步加法调用了");
      return (state.count += n)
    },
    mutationsReduceCount(state, n = 0) {
      console.log("mutations异步减法调用了");
      return (state.count -= n)
    }
  },
  actions: {
    //异步加载
    actionsAddCount(context, n = 0) {
      console.log(context);
      console.log("actions异步加法调用了");
      return context.commit('mutationsAddCount', n)
    },
    actionsReduceCount({ commit }, n = 0) {
      console.log("actions异步减法调用了");
      return commit('mutationsReduceCount', n)
    }

  },
  modules: {
  }
}

export  default Nums;
